package com.wiloon.java8x.datetime;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateTimeTest {

    public static void calendartest() {
        Date systemTime = Calendar.getInstance().getTime();
        System.out.println(systemTime);
        //Mon Nov 23 09:04:21 CST 2015

        Date date = new Date();
        System.out.println(date);
        //Mon Nov 23 09:04:21 CST 2015
    }

    public static String getCurrentDateYYYYMMDD() {
        DateFormat format = new SimpleDateFormat("yyyy/MM/dd");
        return format.format(new Date());
    }

    public static void main(String... args) {
       // calendartest();
        System.out.println(new Date(1491289456298l));
        System.out.println(new Date(9007199254740992l));
    }

    public static void mtodate() {
        System.out.println(new Date(16505828420659l));
    }

    public static void dateTest() {
        String str = null;
        str = "2014-11-10 10:02:36,878";
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");

        Date date = null;

        try {
            date = format.parse(str);
            String a = "sss";
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
